package com.flyxiaozhu.erp.service.resps;

import com.flyxiaozhu.erp.core.entities.GoodsAttrName;
import com.flyxiaozhu.erp.core.utils.CollectionUtils;
import lombok.Data;

import java.util.List;

@Data
public class GoodsAttrResp extends BaseResp {
    Long id;

    String name;

    List<GoodsAttrValueResp> goodsAttrValues;

    public GoodsAttrResp(Object o) {
        super(o);
    }

    public GoodsAttrResp(GoodsAttrName attr) {
        super(attr);

        if (attr.getGoodsAttrValues() != null) {
            goodsAttrValues = CollectionUtils.map(attr.getGoodsAttrValues(), GoodsAttrValueResp::new);
        }
    }
}
